fixed boolean casting to/from api python equivalents