Fix bug with duplicate frames