fixed last piece issue