bugfix and windows compilation fix