fix bug in last commit and emit removed nodes by calling context function