Repeat Count not working correctly on KOBO collect

Hello,
Please I have this repeat count which is suppose to minus either the male or female head of household and repeat remaining number family members. It works fine on Enketo but on KOBO and ODK collect if the household size is 1 and I enter the details of the head of household (either Male or Female) it still ask for one additional household member. However if its more than 1 the repeat count works perfectly well.
if(${Male_HHH} != ‘’ and ${Female_HHH}!= ‘’, ${HH_Size}-2 , ${HH_Size}-1)

I would appreciate your support in resolving the problem.
Thanks.

@fya, could you share the relevant part of the XLSForm with the community so that the community could also help testing it out for you?