fixed freezing when input is 2*2*