Windows support and bugfixes