I am testing bootstrapping with other parameter choices, but plaintexts are ruined after bootstrapping with smaller scaling factor such as 40.

I know other experiments with this small scaling factor without this severe accuracy problem, and bootstrapping with small scaling factor worked with other library( GitHub - snucrypto/HEAAN ). So I know that bootstrapping works with smaller scaling factor theoretically and practically, even precision is deteriorated.

What do I miss? does there any further parameter adjustment required to bootstrap with small scaling factors?

There are couple of things you will need to tweak:

Change the secret distribution from UNIFORM_TERNARY to SPARSE_TERNARY (only sparse secrets are used in HEAAN, to the best of my knowledge). This will gain several bits of precision.

Update both first mod size and scaling mod size. For instance, I tried in the past first mod size = 47 and scaling mod size = 44. Keep the difference between first and scaling mod size at 3 or so.

You can also reduce the ring dimension (but this may also reduce the security work factor; so please be careful when doing this).

You can reduce the batchSize either at the cryptocontext level or for specific ciphertexts. The sparser the ciphertext, the higher is the precision.