refactor bugfixes and typos