fixed the previous commit w.r.t permissions checking