Some error checking.