some memory leak, auth fixes