remove nested function patch