Added basic error handling and fixed a bug in the MessageBox helper.