fixed bug in authorize function call (access memory freed)