Small improvements to avoid unnecessary redirects