array index issue fix