Fixed bug in previous error checking improvement.