fixed saving/deleting bugs created by refactor