fix bug in format.js