fixed addCategory function