Fix inner procedure generation