Bug fixes and mcdc improvement