fixing a corner case on Windows
refactoring