Changes to avoid memory leaks and  bug in force.entity.js introduced by yesterday's change