fix some error and add sessions api