fixing some io stuffs, TODO: binary mode need to be fixed