Fixed unit tests, port of null exception during startup, compile errors