Fix endPoint security + various small improvements
Fix issue #7: Better security error handling