fixing java.lang.IllegalStateException: Cannot create a session after the response has been committed