check to avoid permissions mistakes moved to the early stages of scripts execution