fix check for 0 || non-zero
(cherry picked from commit 5289a55ba055d0ad201fd6371e311ab0c6e74438)
add test

(cherry picked from commit eb178641ed959827edb6d01737bccf2d6a915e68)
add build