support usage of first/last/take with limit
Fix failing test and add more tests for first/last/take
with limit argument, fixes #322 and #323.