change mode from "r" to "r+"