Fix getting SP
Don't allocate memory for each task any more
Fix context memory allocation