Fix a potential bug of frame