fixed bugs in the discard controller