Fix several incorrect array indices
* fixes preference handling
* fixes custom client IDs