fix order of conditonal branch