ready() function not working