added try/catch around ready state 2