various fixed, add a dom() function to terminal.js