Minor javascript, missing function closure