various bug fixes, improvements wip