bug fix when no contracts in database