Making sure we check for Objects only

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