fixes #303
Merge pull request #350 from micahflee/automatic-keygen

Automatic keygen