Fixed some bugs in ifHandle