support usage of first/last/take with limit (attempt to fix #322)