added  check for entity