Imap_email_content error

I had a imap sensor working. it would post the subject as it state. I tried to get it to post the date attribute as the state. but I gave up on that and just removed the sensor template I was trying just to go back to seeing the subject line. But now when hassio restarts I get this error.

sensor.yaml

  - platform: imap_email_content
    server: imap.gmail.com
    name: upstairs_alexa_notify
    port: 993
    username: redacted
    password: redacted
    senders:
      - [email protected]
imap_email_content: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/imap_email_content/sensor.py", line 239, in update
    message = EmailContentSensor.get_msg_subject(email_message)
  File "/usr/src/homeassistant/homeassistant/components/imap_email_content/sensor.py", line 194, in get_msg_subject
    decoded_header = email.header.decode_header(email_message["Subject"])
  File "/usr/local/lib/python3.7/email/header.py", line 80, in decode_header
    if not ecre.search(header):
TypeError: expected string or bytes-like object

Well I fixed it I guess. I emptied the inbox then restarted HA. Seems like it breaks if there is exsisting emails in there.