Fix redirects and env variables