fix some bugs in open