Bugfixes for Unit tests