bugfix for windows and cleanup