fix(main) various bug fixes