error message printing improved