generate if required