finish save data function