Fixes some unit test bugs