Fixed an issue where splice was removing the wrong number of array elements.