Fix strToInt64 function and add unit tests