fixed to send to security
some fixes for functionality and logging