Fix infinite redirect when there are no images