bugfixes for windows - thanks to Javier Montoya