fixed exception catching