added debug function