fixed emitting of errors and warnings