fixed bug with empty database