fix bug in open handler