Added check to see if there was actually an error