Improves error checking.