corrected array bug