a couple of bug fixes