Fix generate method