Added some debug checks