fixed opening document from command line