Fixed a bug where entering outcome for diagnostic would be lost. Moved some code to meta_globals.