Wrap generated code in a block if necessary, fixes #160