Fixing some typos and bugs