Fixed bug in javascript rendering