Fix test hanging.
Minor cleanups.