added check fo r ready state of request