fixed incorrect memory allocation in explode()