fixes for unit tests including critical fixes