kalua: db: check() count lines - restore() minor cleanup