Yet more bug fixes