fixed terry logic issue