[c] fixed an issue with read fn