Fix a wrong error message AND error handlings