Fixed wrong for cicle in getCenter global function
Some cleanup and removed some warning in gcc 4.6.3