debugged the temp_array
made the loop never ending