make session and cursor use more check on validation.