Fixed the function revertListIntoArray