feat: fix replace function
Merge pull request #1 from christophwitzko/master

fix replace function and some small refactoring