Fix type detection