massive bug fixes