fixed infinite-ish loop in array assignment