[BZ-1043395] fix recognition of formulas and free form expressions