code refactoring in core.js
 - minor issue