Fixes bug where error class hangs around