Add guard for string type/ [code review]