fixed entity deletion bug