Fix crash when opening empty dataset