Fixed bug when switching from spr to py