fix bugs in error messages