Fixing thread sync on webapi