Fixing up some IO behaviour