Removed debug lines and fixed channel flag check