updated exception catching