fixes #2 (including isValidFile and isValidDir corrections)