Fix bug that input fields kept being readded to the array.