Bug fixes around validation