You should invoke the callback before the function returns.