fix accidental recursive function