Fix logical issue