Fixed issue with image encoding. Log trace of callback exceptions.