Fixed validity bugs