updated the debug-function and wrote an error-function