Fix bugs related to long data type