Fixed possible bug if category is empty, closes #830