Sanity checks for slideshow and gallery handles

Just check and fix if glob call does not return an array.