Added type check for isPrimitive and isPrimitiveNoBool