move pref reading block to a point after the path to the script is resolved