fixed obscure bug when db is slightly malformed due to ^C. Tweak server gating, it is still not quite right...