fixing array bug