A couple of bug fixes