Corrected error where only the first element of the array was being
updated.