cant figure out why this closure doesnt work