Fix issue with appendStrToArray not including the last element of the original array