fixing and cleaning encapture.js