Fix bug where categories with spaces would be truncated