Fix compiler warning and linker error