Fixed exception handler