Remove null character when getting value as a string