Improve virtual script path handling (#930)