try function on ready