Making sure we check for Objects only

(typeof types === 'object') would return true on arrays. Fixed it to work for objects only