added proper priv folder detection