Fix errors on Gallery page when directory doesn't exist