fixed a bug on the saveDoc() on the preg_replace() function