insert error checking