Fixed crash because of incorrect string releasing

There is mistake in #230. This patch fixes it.