log handle + severity + small memory leak fixes