Add missing include
Use correct unsigned type for loop indices