fixed a logic bug