Bug fixes and updating to $log.debug