Propably you're passing function local variable to asyncronous function call. Asynchronous call is randomly processed completely after end of function (depends on timing) and in that case...