Fixed some bugs according datatype changes