defined ready function to avoid errors