Fixes bugs and typos