two minor bugs in api/dom.js