Update core.js

Better handling of overflow (leave debugToggle visible).