Detoxification of excess selenium and chlorine