gateway: do not use bitwise operators for logic conditions