Fixed issue #1336 by adding refernce to session to request