fixing security issue and putting notifications into a try/catch