Fixed autodetection of media templates