Fix the bug on the auxiliary function