Corrections and bugfixs

Corrections for CSP, code security improved and corrections for code
best practices