update generate method