For the not selected notes use the put command and the select/replace command only for the selected note. Because only the actual selected note is not updated until you switch to another note and back again.