Fix deserialization of loops, python side (ref #671)