Fix some compiler warnings, closing #1781.