Fixing error messages and tests