Improved handling of cases where contract is not found.