Fixed segfault on GCC, updated ninja file for easier windows builds (and easier debug builds)

All tests are passing, even on TeamCity.