Input/output fixing in Main