validations to prevent errors