Fixed most compile errors caused by removal of dependency on old
NightLabs libs.