Adding some missing tests
More coverage for unit tests and fixed some errors