fixed the array bug