added some functions in iolib.c