Fix last() handling