Fix files opening from command line

Thanks to sigo for the bug report.