Ported oplin changes back to the jsdemo: