Fixed bug where UI states wasn't properly updated after code was changed in the code dialog.