Fixed file opening when called from external application