Fixing truncate error and distance