Fix a few test issues, and simplify on "ready" event.