similarly for other error checks below it