fixed discard bug