bug fix on split function