Fixed  bug with error messages getting displayed