util: more strict type check for bool/number/string