Replace some alert() with assert()