string: avoid unnecessary segfaults