Fixes bug regarding split, var need to be outside