fixed timeout functionality of ready function