Fix bug in IO library