Fix zero length replacements
Merge branch 'bug-py26'