fixed incorrect number of conditions