Fix usage of arrays and ordering