Fixed bug in finding parent directory.