fix test for windows
fix error handling