fix error message not returning