fix error and warnings (gcc 4.7)