fixed crash in python demo