Allow for custom values to have keys not starting at 0

Because of the for loop with $i starting at 0, if custom values were added after non-custom values they would be ignored because their keys did not start at 0.