Fixing email bug that resulted in failed documents