Update xlayout.js

More bug fixes.