Fix some unit testing problems