fix DEBUG and ERROR functions