Handle port redirection from localhost; fix Gemfile usage from outside the script folder.