FIX: const-correctness fix plus some warnings removed.