Several path handling improvements and more tests