Fix Windows related issues and warnings