fixing bugs for validation