fixes KON-6
creating session factory wrapped with try finally
added 500 http response