Fix handling empty formulas