Fixed exception handling errors