fixed error in writing frames, writer