Remove duplicates and fix build