fixed some bugs of ICM and functions used by ICM