fix cache of script because it is not thread safe

Scripts are not thread safe because of the binding that use maps
We now cache it using the thread id
Also fixed an issue on evaluation of engine constant on flow nodes that are not activities