Handle entities that are already deleted (fixes #672)