Fix string overridden memory issue