Merge "Fixes to thread safety problems in SCL compiler"