logical error fixed