Fixed some bugs in intersection