refactor fix sql insert error