lastP0/lastP1 indices bug fixed