Added some contract checks