implemented returning last n elements when second arg is a object