Fix concurrency issue in categories