edit 'layout.js' and fixed bugs