much better primitive type detection