In well_conn_alloc_wellhead(), the arguments to well_conn_alloc() are swapped: open is cast to the direction enum and well_conn_dirZ is passed where the open boolean should be. This will set an incorrect direction for the wellhead connection (and always treat it as open).
Also in well_conn_alloc_wellhead(), the arguments to well_conn_alloc_fracture() are swapped (same issue as the matrix_connection branch): open is being cast to the direction enum and well_conn_dirZ is passed as the open boolean.
In well_conn_alloc_wellhead(), the arguments to well_conn_alloc() are swapped: open is cast to the direction enum and well_conn_dirZ is passed where the open boolean should be. This will set an incorrect direction for the wellhead connection (and always treat it as open).
Also in well_conn_alloc_wellhead(), the arguments to well_conn_alloc_fracture() are swapped (same issue as the matrix_connection branch): open is being cast to the direction enum and well_conn_dirZ is passed as the open boolean.