More security improvements
Fix some notice errors in legacy