Bug fixes and categories fixes