Add some validity checks