check if key 'category' exists before using it.