removed superfluous readlines(), added seek(0)