validation and bug fix