Fix string format security warnings and use correct header for case-sensitive file systems