Added sanity checks.
Flush old serial data after sleep.