check for invalid returns and errors