Fixed security issues, small improvements