encode bool type with 0 or 1, update tests