Everything seems OK, except for a bug in IO