Fixed some bugs, typos etc.