Small fixes to formula script generation.