a LOT of bug fixes