modified the code to work with latest pyretic release