check permissions earlier