Fixed error “Cannot read property ‘slice’ of undefined”