fixed memory leak on delegates