Fixed exception which was thrown when editing a task's custom field value.
Improved exception logging.
Fixed exception on shutdown.