Fixed Code Contract issues