fixed bug with closure