fixed writing js files