minor tweak, handles empty db better