Adapt changes from 7a6907d to py interface