add debug messages
fixed empty db rehash case