closure and reference problem