Fix segfault with more than 3 medias