fix for bug #17: ArrayOf doesnt make sure that the return value is an array before checking it. Also adding a contract-specific error ContractError and updating all specs to use this error