Fixed exception handling.