Fix compilation problems with closure