diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index c57ddae02fc60b83109ddc536d8866b555763b76..228dd9e638cbe1f94192af0122171f3a29669fd9 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -5049,7 +5049,7 @@ namespace
 	// Converts symbol to lower case, if it is an ASCII one
 	char_t tolower_ascii(char_t ch)
 	{
-		return static_cast<unsigned int>(ch - 'A') < 26 ? (ch | ' ') : ch;
+		return static_cast<unsigned int>(ch - 'A') < 26 ? static_cast<char_t>(ch | ' ') : ch;
 	}
 
 	xpath_string string_value(const xpath_node& na, xpath_allocator* alloc)
@@ -5759,8 +5759,6 @@ namespace
 }
 
 // Internal node set class
-#include <algorithm>
-
 namespace
 {
 	using namespace pugi;