Several unit tests fixes