Path segments were being dropped when using posixpath.join().