Fixed a bug with terms