Fixes to refdb implementation