Fix error and add exception