Fix string length counting for escapes