writing items to temp db