diff --git a/blocks/blockstore/blockstore.go b/blocks/blockstore/blockstore.go
index 63d5df54bc5d325381028a7448ce11fc073b0e8f..484e151544c138caeb763919edab2cafa6ba97b6 100644
--- a/blocks/blockstore/blockstore.go
+++ b/blocks/blockstore/blockstore.go
@@ -132,6 +132,7 @@ func (bs *blockstore) AllKeysChan(ctx context.Context, offset int, limit int) (<
 
 			// need to convert to u.Key using u.KeyFromDsKey.
 			k = u.KeyFromDsKey(ds.NewKey(e.Key))
+			log.Debug("blockstore: query got key", k)
 			return k, true
 		}
 	}
diff --git a/core/commands/refs.go b/core/commands/refs.go
index 0e26be2c29ddb25efecfe5f06118bf8968f4b559..d9999cdde18e3fb8e53b6b26d6e49fcc8071bdf0 100644
--- a/core/commands/refs.go
+++ b/core/commands/refs.go
@@ -54,6 +54,7 @@ Note: list all refs recursively with -r.
 		cmds.BoolOption("recursive", "r", "Recursively list links of child nodes"),
 	},
 	Run: func(req cmds.Request) (interface{}, error) {
+		ctx := req.Context().Context
 		n, err := req.Context().GetNode()
 		if err != nil {
 			return nil, err
@@ -93,7 +94,7 @@ Note: list all refs recursively with -r.
 			rw := RefWriter{
 				W:         pipew,
 				DAG:       n.DAG,
-				Ctx:       n.Context(),
+				Ctx:       ctx,
 				Unique:    unique,
 				PrintEdge: edges,
 				PrintFmt:  format,
@@ -122,13 +123,14 @@ Displays the hashes of all local objects.
 	},
 
 	Run: func(req cmds.Request) (interface{}, error) {
+		ctx := req.Context().Context
 		n, err := req.Context().GetNode()
 		if err != nil {
 			return nil, err
 		}
 
 		// todo: make async
-		allKeys, err := n.Blockstore.AllKeys(context.TODO(), 0, 0)
+		allKeys, err := n.Blockstore.AllKeysChan(ctx, 0, 0)
 		if err != nil {
 			return nil, err
 		}
@@ -139,7 +141,7 @@ Displays the hashes of all local objects.
 		go func() {
 			defer pipew.Close()
 
-			for _, k := range allKeys {
+			for k := range allKeys {
 				s := k.Pretty() + "\n"
 				if _, err := pipew.Write([]byte(s)); err != nil {
 					log.Error(err)