Move the done callback to a position before it is called

The done callback was called before it was defined causing trouble in firefox 26