Add update function to modify values in  train table.
Fix some bugs and prompt some error message in the screen.