#3841: added new variable for context storage
#3841: updated demo tests
#3841: fixed return value manipulations