fixed frame counter going out of bound