fix some js bugs in first group function