improvied q_script_path internal method