added more debug check