Fix resolveing with promise-like objects, add test