Small all round bug fixes