prevent invalid free when using string slices

I think I must have thought that the INVALID value was -1... :-/

Without this fix, the revised unit test will fault