M: some lastEncoder fixes