Two misc bugfixes