a lot of bug fixes, improvements