lots of bug fixes
WIP