str functions replaced with smart_str, tried to reproduce #39