Added permissions check