Fix raw metadata editor redirection to index

Fixes issues #623, and #627 which were causing redirection to the index page when using the raw metadata editor.

Also fixes it so that metadata removed from the raw metadata editor will also be removed in the commit, before it was leaving it in.