fix last piece bug