initialize on document ready bug fix