fixed errors related to deletion of inactive entities