added correct generate code