Fix generate script, closes #86