Fixed bugs after updating entities