Added error handling for invalid channels