improving error messages and comments