setup usage tests and fix bugs found