Fixed issues with some unit tests
More testing and tweaks