check for error conditions