add logging binding, fix bugs