Fix for the stacked entities problem