Check for data type in set data method.

Now, it accepts scalar too.