Quick fix for a but in indexing class.

Category loading bug fixed - now it checks if category exists before trying to get its ID.