debugging gallery.php