Bug fix for formula parsing