Fixed the scanDatabase function for RL & SBL