fixed nullpointer exception in Generation