LOTS of bug fixes