fixed missing index in switch