Fixes in lookup, prepare_latest and session::clone