Bug fix in displaying error messages