fix inference bug