fixed up some logic.