generate with ref