Couple bugfixes in both engines
Refactoring nmkEngine.cpp