Fix issue #412, textmode not working correctly with js files