Add error checking in x model class.