Corrected bug in required attribute caching
Fixed unit tests and CS