Fixed bug in gen script. Final Commit