fix broken save routine