added check in hasTermFirst