When you disconnect, the channel information stored in # ($chan) that's used in the script is lost, so when you reconnect, the script doesn't know what channel you were kicked/banned from in order to remove the ban.