fixed a bug on replaceUrls() method