bug fix

Fix a bug for bit calculation