Fix casting correctness in ServerKit

We must be careful not to cast parent class void pointers, directly to
subclasses. That will break in multiple inheritance situations.