corrected bug in inference