error catching wasnt working