make sure the $arr is defined