fix overly generic error handling