Handled more cases in do_open