added security checks