debug and clear error