fixed various bugs related to database schema change and login change.