fixed bug in io.R