Added useful data printing when errors happened.