improve open function

Signed-off-by: Jack <jack.wgm@gmail.com>