bug fixes to files in directory refactoring