Fix float formatting problems on some locales, formatting code