fixes some logic