Minor fixes; add test for inference.