fixed terrible boolean logic