added simple validity check