Use begin/end instead of first/last

see CRuby [Bug #8739] of CRuby