Put path setting code in main after code that doesn't depend on it.