avoiding unexpected exceptions