Fixed an error of getting error message