fixed empty database bug