added proper debug function