fixed explode function