minor modification binconv