fix bug in open statement