Function to generate guid corrected