fixes js error on document ready