fix type detection