More seurity issues detected

More issues with security detected and (hopefully) averted. The message
functionality seems to be broken at the moment though, investigating
this..