[minor] Better type detection