Fix input redirection to work for any case