try to improve data insert logic