Fix bug (wrong value computed) when reading file from stdin, implement