Fix caching of prevPos.