fixing js errors