Replace non-standard #substr with #slice.