fixed the parser for arrays using internal stack