correct reading of stdin