Bug fixes in Tests