fix flag count in cache