fix some catd bugs and trim out some dead code