Added 'replace','limit' bugfixes