prevent memory leak on chained promises