Port over Greg's fixes for terms