fix error message and test