Improved exception handling in upload_bof.