Fix bugs with logging handlers.