reentrant library functions don't touch internal variables anymore
copy result from reentrant functions to internal variable after doing stuff
2way merge reith/ashkan on reentrant_fix.
Merge branch 'reith-reentrant_fix'