a lot of bug fixes