fix center calculation