fix Error and Debug when called from a page