store current result before celaring array