fixed if [ $useauto == 1 ]; on fn_generate_key