Fix unit tests and the command line tool so they are operational