fixed input redirect, and added back your changes