str_replace was replacing all instances, using substr_replace instead