Added check for done method on returned promise

This fixes #1