fixed sock write