Code formatting and fix for null locale