fixed some bugs related to arrays and data flow