add debug feature and minor tweaks to es integration