imporved certificate generation