Fixed bugs causing failing compilation on Windows