changed igetsp to stack-based alloc, to be thread-safe