fixed the getLast method