Bug fix in Template elaboration/inference