fix some mistake
improve method 'buildFrames'