add and fix some io things