fix closure capture bug