make last(., order_by=) and first(.,order_by=) more flexible. closes #626