Fixing cache problem with lastPosition