fixed discard bugs