Fix String.prototype.substr for zero length strings