fix a bug in membership function calculation