Fix key/value leaks in sync methods