changed 'valid run' check and oto upload id storage to use database