add missing write method
fix return value handling from read