 
             # Find out if filesystem tree needs a rebuild
             if (not info.direction? and fromRemote and info.docs_written > 0) \
-            or (info.direction is 'pull' and info.change.docs_written > 0)
+            or (info.direction is 'pull' and info.docs_written > 0)
                 needTreeRebuild = rebuildFs
 
             log.info changeMessage

        .nodeify callback


    # Specify which way to replicate
    getReplicator: (toRemote, fromRemote) ->
        if fromRemote and not toRemote
            log.info "Running replication from remote database"

                filesystem.buildTree null, unlockFileSystemAndReturn

        onChange = (info) ->
            console.log info
            changeMessage = "DB change: #{info.docs_written} doc(s) written"

            # Specify direction
            if info.direction
