ensure that only 0 or 1 are returned