Fix categories bug

When using the string type,
$typeid == 1 matched all strings making other conditions ineffective.

3.6 and develop also affected