Add more error checking.