adding in some error reporting code to Emagebuilder