fixed order and missing array values bug