fixed various typos and bugs