Fixed merging problem
Fixed endless loop with small frames