updated read; write is still buggy