Make try-except block more sane