Implement session clearing for editing

Clear previous session when encountering editing errors to make sure latest version is loaded in form. With this commit, a bug preventing this same session from being set has been fixed.