Fixed write() signature