fix bugs in procedural inference