Fixed critical bugs and DSGM_CreateObjectInstance

object.customVariables size was always 4 (sizeof struct *),  custom
variables are initialised to 0,