fix "ready" event handler