modified try-except