A few more bug fixes from michael.