Added a few validations for easier debugging