fixed a bug in the conditional code