Modified the try-except.