Add tests for cat and fix a couple issues