Added fix for empty db bug