A few minor bug fixes