Add tests and change error message