added read and fixed bug