Fix first() and last()