fixing write/read modes