more error code checking