diff --git a/lib/mbtiles.js b/lib/mbtiles.js index cf7a15d..f1d7e03 100644 --- a/lib/mbtiles.js +++ b/lib/mbtiles.js @@ -546,7 +546,7 @@ MBTiles.prototype._commit = function(callback) { // Insert grid_key. var keys = mbtiles._db.prepare('INSERT OR IGNORE INTO grid_key (grid_id, key_name) VALUES (?, ?)'); for (var id in mbtiles._keyCache) { - mbtiles._keyCache.forEach(function(key) { + mbtiles._keyCache[id].forEach(function(key) { keys.run(id, key); }); } @@ -661,7 +661,7 @@ MBTiles.prototype.putGrid = function(z, x, y, data, callback) { this._keyCache[id] = Object.keys(data.data || {}); // This corresponds to the keymap table. - this._dataCache.extend(data.data || {}); + _(this._dataCache).extend(data.data || {}); } // This corresponds to the map table.