Some bugfixes with os.path