fix warnings and linker errors under windows