Fix way related bug

Use local reference (way) to entry in callback, to ensure changing the
right object.
Move the save in to the callback, to save the way after the callback,
instead of before.