fixed logical error.