Fixed confirm discard changes modal issues

Fixed the confirm modal throwing exceptions in certain cases (like
Sections).
Fixed the confirm modal not properly reseting data on discard.