Fix string cast issue in get and setlocal