fixed bug in selecting datatype