Fixed bug due to ereg_replace being deprecated