Added checks to make sure the data was of the correct type; created more helpful error dialog.