Fixing bug where last could be called on nil.