Fixed a bug in str_replace