Revert "Revert "Fixed compile errors for CentOS 6""