Fixed issue with allocate and split

Added tests