Fixed possible segfault in bindings.