py bindings -- fix bugs of prev commit