added some error checking and examining of error stream