fixed bug when plugin was used before document ready