Fixed code to remove bad channels.