Convert booleans and integers to the correct type.