Fixed crash when trying to replace values received from an NSDictionary collection

It will crash with out of bounds when trying to call replace() on a string received from an NSDictionary. Probably because of string termination on the value contained in the NSDictionary