updated security checks to prevent error pages