Fix value type detection