Improved handling of paths