fixed io.open which does not strip trailing newlines