Fix various bugs in parseExptemplate.js