Fixed a bug where one value was getting added at the incorrect position