added fixed writedata