Make String.slice consistent with Ruby semantics, closes #1034