Add debug mode to js cuterpart, log fix for plugin api #43