fixed check permissions method