Reference error: arr not defined