fixed double saving bug