fixed access to invalid memory when converting strings