Fixed css rendering bug with js