Added some security checks.