Fixed analyze scalar function