fixed key-value reverse order of saving