fixed some bugs with inference
d