Ensure term IDs are integers