some fixes and validations