bugfix: error messages not working; also added tests