a number of bug fixes