He asked how to fix the problem, I answered, and he was just happy with this.
As for the %derek var probably never being 0, you just don't know, no point trying to guess without further information.
If you re-read carefuly, you will see that he made that code "channel based" on purpose, again, he might be a good idea to do it "nick based" but there's no point doing so when the code clearly shows it's "channel based".