added debug conditions