move pref reading block to a point after the path to the script is resolved
another attempt to place pref parsing logic in correct location
set location of prefs file relative to the real dir