Solved NPE if lastObject is null