Fixed error on generation script function