improve error messages
improve testing