Fixed bug on handling of an empty sheet in refdb