Fix compiler warnings from Ubuntu 12.04 GCC 4.6.1
Fix compile bugs using Ubuntu 12.04 LTS x86_64