add:print err if debug is true