improve headless.js