Use getState() when setting new state after saving an item

#628