Compile fixes for 4.8

(cherry picked from commit b7c27420aab79d679c61740e6d1f543d4a4f5871)