added foreign keys into database and fixed login bug