Fix refine_input to use exclusive conditions of definitions.