Fix binary write
Fix port for the test