fix some typos, make host detection dynamic, support local dev and production switching on host