added permission check