Fix compiler warnings, improve Windows support.