Fix ready function