logical error, should check all array