Have you verified this change on windows by any chance? In windows, node doesn't see a difference between path to a file and directory (don't know if it's true for Linux/mac), so if you do path.dirname(directory) it will return you a parent of the directory. Most of the code right now is passing in directories, not filepaths.