Fix the bug that data cannot be saved to database