added debug mode for validity