fixing bug where only the first comma is replaced before manipulation