fixed crash in Python bindings