made code reflect error messages