Fix bug: should collct array and scopstmt info before access