Make tree expand return a promise.

Fixes #739