add support of session lookup and minor fix.