Make diagram renderer (python bindings) more stable