Interplay between the glass and the gel transition