fixing bug with spliting on undefined