Fix center-finding code.