Various fixes for windows