generating the correct extension