working read and write for single device