Minor fixes from NMS branch