fix to check readyState

It looks wrong. I fixed to check `readyState`, and fixed a typo.