bug fixes for lego.js