checking that text in clean_invalid_utf8_bytes(text) is not null before calling the encode function on it. some email headers have invalid utf-8 characters and this results in errors for one of Mail libraries. This should now clean up invalid utf-8 bytes in headers too just like in the html